import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/login',
  //   name: 'Login',
  //   component: Login
  // },
  {
    path: '/login',
    name: 'Login',
    // component: () => import(/* webpackChunkName: "login" */ '../views/login/login.vue'),
    component: () => import(/* webpackChunkName: "[request]" */ '../views/login/login.vue')
  },
  {
    path: '/homepage',
    name: 'Homepage',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "homepage" */ '../views/homepage/homepage.vue'),
    children: [
      {
        path: '/good',
        name: 'Good',
        component: () => import('../views/homepage/shop/good.vue')
      },
      {
        path: '/category',
        name: 'Category',
        component: () => import('../views/homepage/shop/category.vue')
      },
      {
        path: '/brand',
        name: 'Brand',
        component: () => import('../views/homepage/shop/brand.vue')
      },
      {
        path: '/attribute',
        name: 'Attribute',
        component: () => import('../views/homepage/shop/attribute.vue')
      },
      {
        path: `/editgood/:id`,
        name: 'Editgood',
        component: () => import('../views/homepage/shop/editgood.vue')
      },
    ]
  }
]

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})
export default router
